package com.wl.proxy;

public class StaticProxy {
    public static void main(String[] args) {
        WeddingCompany weddingCompany = new WeddingCompany(new You());
        weddingCompany.HappyMarry();
    }
}

interface Marry{
    void HappyMarry();
}

class You implements Marry{
    @Override
    public void HappyMarry() {
        System.out.println("要结婚了！！！");
    }
}

class WeddingCompany implements Marry{
    //代理谁->真实目标对象
    private Marry target;

    public WeddingCompany(Marry target) {
        this.target = target;
    }

    @Override
    public void HappyMarry() {
        beforeMarry();
        this.target.HappyMarry();
        afterMarry();
    }

    private void afterMarry() {
        System.out.println("结婚后收尾款");
    }

    private void beforeMarry() {
        System.out.println("结婚前布置现场");
    }
}
